/*
   \file  math_utils.cc
   \brief Utility functions for simple math operations.
*/

/*
   This file is part of libgist.

   libgist is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 2 of the License, or (at your
   option) any later version.

   libgist is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
   for more details.

   You should have received a copy of the GNU General Public License
   along with libgist; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/

/*
   REVISION HISTORY

   $HeadURL: http://libgist.googlecode.com/svn/trunk/drv/math_utils.cc $
   $Id: math_utils.cc 56 2011-09-03 02:08:01Z libgist@gmail.com $
*/

//------------------------------ HEADERS --------------------------------

//----------------------------- NAMESPACE -------------------------------

namespace gistdrv {

//--------------------- FLOATING POINT UTILITIES ------------------------

// Round a floating-point number to the nearest integer
int round(float t)
{
   float rounder = (t < 0) ? -0.5f : 0.5f ;
   return static_cast<int>(t + rounder) ;
}

//-----------------------------------------------------------------------

} // end of namespace encapsulating this file's definitions

/* So things look consistent in everyone's emacs... */
/* Local Variables: */
/* indent-tabs-mode: nil */
/* End: */
